/*
 * PyramideVariableModalite.java Created on 17 juillet 2007, 15:43 To change this template, choose Tools | Template Manager and open the template in the editor.
 */

package fr.limsi.seven;

import java.util.Collection;
import java.util.LinkedList;

/**
 * @author amazaud
 */
public class PyramideVariableModalite {
	private String name;
	private Collection<PyramideVariableNodeModalite> modalites = null;
	private double min_value = Double.MAX_VALUE;
	private double max_value = Double.MIN_VALUE;

	/** Creates a new instance of PyramideVariableModalite */
	public PyramideVariableModalite(String name) {
		this.name = name;
		modalites = new LinkedList<PyramideVariableNodeModalite>();
	}

	public String getName() {
		return name;
	}

	public void addModalite(PyramideVariableNodeModalite mod) {
		if (mod != null) {
			if (!modalites.contains(mod)) {

				modalites.add(mod);

				if (mod.getValue() < min_value)
					min_value = mod.getValue();
				if (mod.getValue() > max_value)
					max_value = mod.getValue();
			}
			if (mod.getGlobalModalite() != this)

				mod.addGlobalModalite(this);
		}
	}

	public Collection<PyramideVariableNodeModalite> getModalites() {
		return modalites;
	}

	public double getMaxValue() {
		return max_value;
	}

	public double getMinValue() {
		return min_value;
	}
}
